package com.wzy;

/**
 * 单例模式
 * 之
 * 静态内部类
 *
 */
public class HisFactory {

    private static HisFactory factory;

    private HisFactory() {
        System.out.println("创建了一个Factory");
    }

    private static class HisFactoryHelper{
        private static final HisFactory F = new HisFactory();
    }

    public static HisFactory getInstance(){
        if (factory==null) {
            factory = HisFactoryHelper.F;
        }
        return factory;
    }
}
